package storage

import "context"

type YStorageKey struct{}

func WithCtx(ctx context.Context, storage IStorage) context.Context {
	return context.WithValue(ctx, YStorageKey{}, storage)
}

func FromCtx(ctx context.Context) (IStorage, bool) {
	val := ctx.Value(YStorageKey{})
	if val == nil {
		return nil, false
	}
	store, ok := val.(IStorage)
	return store, ok
}
